﻿//-------------------------------------------------------------------------------------------
// <copyright file="Entity.cs" company="Russell Wilkins">
//     Copyright (c) Russell Wilkins 2014. All Rights Reserved.
// </copyright>
// <author>Russell Wilkins</author>
// <license href="license.txt">
//     The use of this software is governed by the Microsoft Public License
//     which is included with this distribution.
// </license>
//-------------------------------------------------------------------------------------------
namespace Ripple.Data
{
    using System;
    using System.ComponentModel;
    using System.Runtime.CompilerServices;

    /// <summary>
    /// Base class for all entities.
    /// </summary>
    public abstract class Entity : INotifyPropertyChanged
    {
        public Entity(IRippleContext rippleContext)
        {
            this.RippleContext = rippleContext;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        public DateTime Updated { get; internal set; }

        protected IRippleContext RippleContext { get; private set; }

        private void NotifyPropertyChanged([CallerMemberName] String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}